﻿using System;
using System.Collections.Generic;
using System.Linq;
using LayeredArchitectureSample.DomainModel;

namespace LayeredArchitectureSample.ViewModel
{
    // TODO: autogenerate
    internal class RouteViewModel
    {
        private readonly IEnumerable<LocationViewModel> _waypoints;
        private readonly string _asText;

        public RouteViewModel(IEnumerable<LocationViewModel> waypoints, long id)
        {
            Id = id;
            if (waypoints == null) throw new ArgumentNullException("waypoints");

            _waypoints = waypoints;

            if (id != UnspecifiedRoute.Id)
            {
                _asText = String.Join(" => ", _waypoints.Select(wp => wp.Name));
            }
            else
            {
                _asText = "Not specified";
            }
        }

        public string AsText
        {
            get { return _asText; }
        }

        public long Id { get; private set; }
    }
}